package com.example.sinya.exoplayer.demo;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;

/**
 * @author Sinya
 * @editor
 * @date 17/4/2018 4:16 PM
 * @describe
 */
public abstract class BaseActivity extends Activity {
    public static final String RAW_ID = "raw_id";
    private int rawId = -1;

    protected abstract int getLayout();

    protected void initUI() {

    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getLayout() != 0) {
            setContentView(getLayout());
        }
        initUI();
    }

    protected int getRawId() {
        if (rawId == -1) {
            rawId = getIntent().getIntExtra(RAW_ID, R.raw.wx_camera_0);
        }
        return rawId;
    }
}
